<?php

require_once("conn.php");
$db = new DBC();

$dir = "../game/question";
if (is_dir($dir)) {
    if (($dir_handle = opendir($dir)) != false) {
        while (($file = readdir($dir_handle)) !== false) {
            if ($file != "." && $file != "..") {
                $code = explode(".", $file);                
                $url = getDomain()."game/question/" . $file;
                $sql = "UPDATE t_game_question SET url = '" . $url . "' WHERE code = '" . $code . "'";
                $db->execute($sql);
            }
        }
        closedir($dir_handle);
    }
}

echo "<script language='javascript'>location='questionList.php?menu=question';</script>";
?>
